//
//  AccountTool.m
//  Chat
//
//  Created by Wangchengshan on 15/10/26.
//  Copyright (c) 2015年 Wangchengshan. All rights reserved.
//

#import "AccountTool.h"

#define AccountFilePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"account.data"]

@implementation AccountTool

+ (void)saveAccount:(UserAccount *)account
{
    // 归档
    [NSKeyedArchiver archiveRootObject:account toFile:AccountFilePath];
}

+(UserAccount *)account
{
    // 读取帐号
    UserAccount *account = [NSKeyedUnarchiver unarchiveObjectWithFile:AccountFilePath];
    
    return account;
}

@end
